{extend name="layout/iframe_layout" /}

{block name="title"}操作日志{/block}
{block name="style"}
<style>
/*自定义样式*/
</style>
{/block}

{block name="content"}

<div id="app" >
    <div class="app-container">
        {include file="public/search_form" /}

        <div class="action-btns">
            <el-button-group>
                <el-button type="info" size="mini" icon="el-icon-refresh" @click="search">刷新</el-button>
                <!--<hook_add_button-->

            </el-button-group>
            <el-button-group>
                <el-button type="primary" size="mini" icon="el-icon-menu" @click="showColumnSetting = true">字段配置</el-button>
            </el-button-group>
        </div>
        <el-table
                ref="multipleTable"
                v-loading.fullscreen.lock="listLoading"
                element-loading-text="拼命请求中..."
                element-loading-spinner="el-icon-loading"
                element-loading-background="rgba(0, 0, 0, 0.6)"
                :data="list"
                element-loading-text="Loading"
                border
                fit
                highlight-current-row
                tooltip-effect="dark"
                style="width: 100%"
                align="center"
                @selection-change="handleSelectionChange"
        >
            <!--      <el-table-column type="selection" width="55" align="center" prop="id"/>-->
             {include file="public/table_column" /}
        </el-table>

        <!-- 字段设置对话框 -->
        {include file="public/show_column_setting" /}
        <!--分页-->
        {include file="public/pagination" /}
    </div>

    <!-- 弹窗：新增/编辑 -->
     {include file="public/form-dialog" /}

</div>
{/block}

{block name="script"}
<script src="/static/lib/jquery/jquery.min.js"></script>
    <!--别删除-->
    <!--hook_upload_m-->

<script>
    Vue.mixin(commonMethods);//引入公共方法

    //别删除
    //<hook_upload_m>
    var api_base = '/admin_action_log';
    var auto_id = 'id';
    new Vue({
        el: '#app',
        data() {
            return {
               dialogVisible: false,
                //<hook_form_filed>,
            };
        },
        methods: {
            add() {
                Object.keys(this.form).forEach(key => this.form[key] = '');
                 this.form.id = 0;
                this.dialogVisible = true;
            },
            edit(row) {
                this.form = Object.assign({}, row);
                this.form.id = row[auto_id];
                this.dialogVisible = true;
            },
            saveData() {
                (this.form.id? put(api_base+'/save', this.form) : post(api_base+'/save', this.form))
                    .then(res => {
                        if (res.code != 0) {
                            this.$message.error(res.msg || '保存失败');
                            return;
                        }
                        this.$message.success(this.form.id ? '已更新' : '已新增');
                        this.dialogVisible = false;
                        this.fetchData(true);
                    }).catch(error => {
                    console.error('保存功能失败:', error);
                });
            }
        },
        mounted() {
            this.fetchListConfig();
            this.fetchData();
        }
    });
</script>
{/block}
